 var id = getvl("id");
  var shopid="";
 $(function(){
 	 if(id!=''){
     	$.ajax({   
            url: urlcore + "/api/shopInfo/selectagno1?id="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
				shopid=data.data.id;
					dianpusum();
				}
			},
			error: function() {
				alert("error");
			}
		});   
 }
 });


 
 var currentPage=1;
 var currentPage2=1;
 var ss=0;
 var ss1=0;
 //评论所有
 
 
 function  dianpusum(){
 	 if(currentPage==1 || currentPage==2 || ss!=0){
 	  	$("#pingjiaxinxi2").html("");
 	  		ss1=0;	
 	  	currentPage2=1;
     	$.ajax({   
            url: urlcore + "/api/comment/dianpusum2?current=" + currentPage+"&shopId="+shopid+"&type=1",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					
					$("#pingjiadengji").html("");
					var da=data.data;
				
					var pingjiadengji='<div class="sell_pingjia_title clearfix">'+
'		<h5>好评率：<span>'+da.shopInfo.praiseRate+'%</span></h5>'+
'		<em>'+da.Sun+'条评价</em>'+
'	</div>'+
'	<ul class="clearfix">'+
'		<li class="clearfix">'+
'			<span>商家服务</span>';
                for(var i=0;i<da.shopInfo.serviceLevel;i++){
            pingjiadengji+='<img src="../images/star.png" />';
                }
                  for(var i=0;i<5-da.shopInfo.serviceLevel;i++){
            pingjiadengji+='<img src="../images/xin2.png" />';
                }
                
  pingjiadengji+='		</li>'+
'		<li class="clearfix">'+
'			<span>商品品质</span>';
                 for(var i=0;i<da.shopInfo.qualityLevel;i++){
            pingjiadengji+='<img src="../images/star.png" />';
                }

         for(var i=0;i<5-da.shopInfo.qualityLevel;i++){
            pingjiadengji+='<img src="../images/xin2.png" />';
                }
     pingjiadengji+='</li>'+
'		<li class="clearfix">'+
'			<span>物流服务</span>';
           for(var i=0;i<da.shopInfo.carLevel;i++){
            pingjiadengji+='<img src="../images/star.png" />';
                }
           
            for(var i=0;i<5-da.shopInfo.carLevel;i++){
            pingjiadengji+='<img src="../images/xin2.png" />';
                }
  pingjiadengji+='</li>'+
    '</ul>';
			$("#pingjiadengji").append(pingjiadengji);	
		$("#quanbupingjia").html("全部评价("+da.Sun+")");
						ss=da.commentList.length;
			$.each(da.commentList, function(y,n) {
				var pingjiaxinxi='<div class="sell_pingjia1">'+
'	    	<div class="sell_pingjia_xinxi">'+
'	    		<div class="sell_pingjia_tu">'+
'	    			<img src="'+n.user.headImg+'"/>'+
'	    		</div>'+
'	    		<div class="sell_pingjia_wenzi">'+
'	    			<div class="sell_pingjia_mz clearfix">'+
'	    				<h5>'+n.user.userName+'</h5>'+
'	    				<div class="fr">';
                    for(var m=0;m<n.serviceLevel;m++){
                    	pingjiaxinxi+='<img src="../images/star.png" />';
                    }
                      for(var m=0;m<5-n.serviceLevel;m++){
                    	pingjiaxinxi+='<img src="../images/xin2.png" />';
                    }
pingjiaxinxi+='							<i>'+n.serviceLevel+'.0分</i>';

   /* var gmtDatetime = new Date(n.gmtDatetime).pattern("yyyy-MM-dd hh:mm:ss");   */       
        pingjiaxinxi+='</div>'+
'	    			</div>'+
'	    			<span>'+n.gmtDatetime+'</span>';
                       if(n.commentContent==null){
                       	pingjiaxinxi+='<p></br></br></p>';
                       }else{
                       	pingjiaxinxi+='<p>'+n.commentContent+'</p>';
                       }
                  if(n.isImg!=0){
         	pingjiaxinxi+='<div class="sell_pingjia_img clearfix">';
         	             var imgarr1 = n.commentImg.split("***");
         	             $.each(imgarr1, function(index, value) {
            pingjiaxinxi+='<img onerror="errorImg(this)" src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
            pingjiaxinxi+='</div><br>';
                  }
pingjiaxinxi+='</div>'+
'	    	</div>';
 if(n.replymessageList!=null && n.replymessageList!=""){  //回复的消息
                         $.each(n.replymessageList, function(w,q) {
                
               pingjiaxinxi+='<div ><h5 style="padding-left:40px;">回复:'+q.reviewcontent+'</h5></div>';
                         });
                   }
             if(n.status==1){
          pingjiaxinxi+='<div class="sell_pingjia_a">'+
'	    		<a href="#" onclick="huifuyemian('+n.id+')" >回复评论</a>'+
'	    	</div>';
             }
              pingjiaxinxi+='</div>';
              $("#pingjiaxinxi").append(pingjiaxinxi);
			});		
			$("#daiwohuifu").html("等待我回评("+da.agSun+")");
				}
			},
			error: function() {
				 alert("error");
			}
			
		}); 
			
 	  			}

 }
 
 
 
 
 function  dianpusum2(){
 	 if(currentPage2==1 || currentPage2==2 || ss1!=0){
 	  	$("#pingjiaxinxi").html("");
 	  		ss=0;	
 	  	currentPage=1;
     	$.ajax({   
            url: urlcore + "/api/comment/dianpusum2?current=" + currentPage2+"&shopId="+shopid+"&type=2",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					$("#pingjiadengji").html("");
					var da=data.data;
					var pingjiadengji='<div class="sell_pingjia_title clearfix">'+
'		<h5>好评率：<span>'+da.shopInfo.praiseRate+'%</span></h5>'+
'		<em>'+da.Sun+'条评价</em>'+
'	</div>'+
'	<ul class="clearfix">'+
'		<li class="clearfix">'+
'			<span>商家服务</span>';
                for(var i=0;i<da.shopInfo.serviceLevel;i++){
            pingjiadengji+='<img src="../images/star.png" />';
                }
                for(var i=0;i<5-da.shopInfo.qualityLevel;i++){
            pingjiadengji+='<img src="../images/xin2.png" />';
                }
  pingjiadengji+='		</li>'+
'		<li class="clearfix">'+
'			<span>商品品质</span>';
                 for(var i=0;i<da.shopInfo.qualityLevel;i++){
            pingjiadengji+='<img src="../images/star.png" />';
                }
                 for(var i=0;i<5-da.shopInfo.qualityLevel;i++){
            pingjiadengji+='<img src="../images/xin2.png" />';
                }

     pingjiadengji+='</li>'+
'		<li class="clearfix">'+
'			<span>物流服务</span>';
           for(var i=0;i<da.shopInfo.qualityLevel;i++){
            pingjiadengji+='<img src="../images/star.png" />';
                }
           for(var i=0;i<5-da.shopInfo.qualityLevel;i++){
            pingjiadengji+='<img src="../images/xin2.png" />';
                }
  pingjiadengji+='</li>'+
    '</ul>';
			$("#pingjiadengji").append(pingjiadengji);	
			
		$("#quanbupingjia").html("全部评价("+da.Sun+")");
					
						ss=da.commentList.length;
			
			$.each(da.commentList, function(y,n) {
				var pingjiaxinxi='<div class="sell_pingjia1">'+
'	    	<div class="sell_pingjia_xinxi">'+
'	    		<div class="sell_pingjia_tu">'+
'	    			<img src="'+n.user.headImg+'"/>'+
'	    		</div>'+
'	    		<div class="sell_pingjia_wenzi">'+
'	    			<div class="sell_pingjia_mz clearfix">'+
'	    				<h5>'+n.user.userName+'</h5>'+
'	    				<div class="fr">';
                    for(var m=0;m<n.serviceLevel;m++){
                    	pingjiaxinxi+='<img src="../images/star.png" />';
                    }
                      for(var m=0;m<5-n.serviceLevel;m++){
                    	pingjiaxinxi+='<img src="../images/xin2.png" />';
                    }
   pingjiaxinxi+= '							<i>'+n.serviceLevel+'.0分</i>';

   /* var gmtDatetime = new Date(n.gmtDatetime).pattern("yyyy-MM-dd hh:mm:ss");   */       
        pingjiaxinxi+='</div>'+
'	    			</div>'+
'	    			<span>'+n.gmtDatetime+'</span>';
                       if(n.commentContent==null){
                       	pingjiaxinxi+='<p></p>';
                       }else{
                       	pingjiaxinxi+='<p>'+n.commentContent+'</p>';
                       }

                  if(n.isImg!=0){
         	pingjiaxinxi+='<div class="sell_pingjia_img clearfix">';
         	             var imgarr1 = n.commentImg.split("***");
         	             $.each(imgarr1, function(index, value) {
            pingjiaxinxi+='<img onerror="errorImg(this)" src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
            pingjiaxinxi+='</div><br>';
                  }
                  
pingjiaxinxi+='</div>'+
'	    	</div>';


             if(n.status==1){
          pingjiaxinxi+='<div class="sell_pingjia_a">'+
'	    		<a href="#" onclick="huifuyemian('+n.id+')" >回复评论</a>'+
'	    	</div>';
             }
             
              pingjiaxinxi+='</div>';
              $("#pingjiaxinxi2").append(pingjiaxinxi);
			});		
			$("#daiwohuifu").html("等待我回评("+da.agSun+")");
				}
			},
			error: function() {
				 alert("error");
			}
			
		}); 
			
 	  			}

 }
 
 
 
 

function huifuyemian(ids){
	 window.location.href="29.1.0pingjiaguanli_huiping.html?id="+ids
}



 //评论所有
	/* function  daihuifu(){
// 	alert("123");
 	$("#pingjiaxinxi").html("");

     	$.ajax({   
            url: urlcore + "/api/comment/dianpusum?shopid="+shopid,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					var da=data.data;
					//alert("123");
							///回评
					$("#daiwohuifu").html("");
					$("#daiwohuifu").html("等待我回评("+da.pendingreply.length+")");
					if(da.pendingreply!=''){
			$.each(da.pendingreply, function(y,n) {
				var pingjiaxinxi='<div class="sell_pingjia1">'+
'	    	<div class="sell_pingjia_xinxi">'+
'	    		<div class="sell_pingjia_tu">'+
'	    			<img src="'+n.user.headImg+'" />'+
'	    		</div>'+
'	    		<div class="sell_pingjia_wenzi">'+
'	    			<div class="sell_pingjia_mz clearfix">'+
'	    				<h5>'+n.user.userName+'</h5>'+
'	    				<div class="fr">';
                    for(var m=0;m<n.serviceLevel;m++){
                    	pingjiaxinxi+='<img src="../images/star.png" />';
                    }
/*'							<i>4.0分</i>'+*/
/*    var gmtDatetime = new Date().pattern("yyyy-MM-dd hh:mm:ss");        
        pingjiaxinxi+='</div>'+
'	    			</div>'+
'	    			<span>'+n.gmtDatetime+'</span>';
                       
                    if(n.commentContent==null){
                    	pingjiaxinxi+='<p></p>';
                    }else{
                 pingjiaxinxi+='<p>'+n.commentContent+'</p>';
                    }

                  if(n.commentImg!=null){
         	pingjiaxinxi+='<div class="sell_pingjia_img clearfix">';
         	             var imgarr1 = n.commentImg.split("***");
         	             $.each(imgarr1, function(index, value) {
 pingjiaxinxi +='<img src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
pingjiaxinxi+='</div>';
                  }
pingjiaxinxi+='</div>'+
'	    	</div>';
             if(n.status==1){
          pingjiaxinxi+='<div class="sell_pingjia_a">'+
'	    		<a href=""  onclick="huifuyemian('+n.id+')">回复评论</a>'+
'	    	</div>';
             }
              pingjiaxinxi+='</div>';
              	$("#pingjiaxinxi").append(pingjiaxinxi);
              
			});		
					}
			
				}
			},
			error: function() {
				 alert("error");
			}
			
		});  } */
 